<template>
  <div class="counsel-wrapper">
    <Scroll class="counsel-scroll" v-if="conselorList.length" :data="conselorList">
      <div class="content">
        <div class="panel-counsel" v-for="(item, index) of conselorList" :key="index">
          <div class="top">
            <div class="left">
              <p class="name">{{ item.name }}</p>
              <p class="time">{{ item.created_at }}</p>
            </div>
            <div class="right">
              <a :href="'tel:'+ item.phone">
                <i></i>
                <span>{{ item.phone }}</span>
              </a>
            </div>
          </div>
          <div class="bottom">备注：{{item.message ? item.message : '暂无备注'}}</div>
        </div>
      </div>
    </Scroll>
    <no-result v-else :src="require('@/assets/images/1-wdhd.png')" msg="暂无咨询客户" />
  </div>
</template>
<script>
import Scroll from '@/components/scroll/scroll'
import NoResult from '@/components/no-result/no-result'
import { getConselorList } from '@/api/my'
const ERR_OK = 200
export default {
  components: {
    Scroll,
    NoResult
  },
  data () {
    return {
      conselorList: []
    }
  },
  created () {
    this._getConselorList()
  },
  methods: {
    _getConselorList () {
      getConselorList()
        .then(res => {
          if (res.code === ERR_OK) {
            this.conselorList = res.data
          }
        })
        .catch(err => {
          console.log(err)
        })
    }
  }
}
</script>
<style lang="scss" scoped>
.counsel-wrapper {
  position: fixed;
  left: 0;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: 9;
  background: #f7f7f7;
  touch-action: none;
  .counsel-scroll {
    width: 100%;
    height: 100%;
  }
  .content {
    width: 100%;
    padding: 0.56rem 0.36rem;
    box-sizing: border-box;
    .panel-counsel {
      width: 100%;
      padding: 0.4rem 0.36rem;
      box-sizing: border-box;
      background: #fff;
      font-size: 0;
      margin-bottom: 0.42rem;
      .top {
        display: flex;
        justify-content: space-between;
        .left {
          .name {
            font-size: 0.28rem;
            font-family: PingFang SC;
            font-weight: 400;
            color: rgba(4, 0, 0, 1);
          }
          .time {
            font-size: 0.2rem;
            font-family: PingFang SC;
            font-weight: 400;
            color: rgba(4, 0, 0, 1);
            margin-top: 0.2rem;
          }
        }
        .right {
          a {
            display: flex;
            align-items: center;
            i {
              display: inline-block;
              width: 0.34rem;
              height: 0.32rem;
              background: url("../../assets/images/icon_ddh.png") no-repeat;
              background-size: cover;
              margin-right: 0.18rem;
            }
            span {
              font-size: 0.2rem;
              font-family: PingFang SC;
              font-weight: 400;
              color: rgba(0, 4, 0, 1);
              line-height: 0.32rem;
            }
          }
        }
      }
      .bottom {
        font-size: 0.2rem;
        font-family: PingFang SC;
        font-weight: 400;
        color: rgba(102, 102, 102, 1);
        line-height: 0.32rem;
        margin-top: 0.3rem;
      }
    }
  }
}
</style>
